//选项构造函数
function iteam_construct(title,txt,img,url){
    this.title = title;
    this.txt = txt;
    this.img = img;
    this.url = url;
    this.toHtml = function(){
        return "<a  target=\"_blank\" href=\""+this.url+"\"><div class=\"iteam\" style=\"background-image: url("+this.img+");\"><div class=\"i_title\">"+this.title+"</div><div class=\"i_txt\">"+this.txt+"</div></div></a>";
    };
}

//元素
var e_iteams = document.getElementById('iteams');
var e_seaf = document.getElementById('seaf');
var e_seatxt = document.getElementById('seatxt');

//测试数据


//选项池
var iteamArr = [
    new iteam_construct("今天吃什么","随机抽一个吧","https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180403%2F2042552db69c4ba590e3ad6e231b27de.gif&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671157832&t=f7142127eb4cb8d9359339ef52588277","http://zengzeng.pro"),
    new iteam_construct("CSDN","程序员中文社区","https://img1.baidu.com/it/u=509263474,2335641035&fm=253&fmt=auto&app=138&f=JPEG?w=401&h=265","http://www.csdn.net"),
    new iteam_construct("百度贴吧","","","http://tieba.baidu.com"),
    new iteam_construct("哔哩哔哩","","",""),
    new iteam_construct("腾讯视频","","",""),
    new iteam_construct("qq邮箱","","",""),
    new iteam_construct("斗鱼直播","","",""),
    new iteam_construct("中国大学Mooc","","",""),
    new iteam_construct("抖音","","",""),
    new iteam_construct("西瓜视频","","",""),
    new iteam_construct("爱奇艺","","",""),

];

//填充数据函数
function arrToHtml(){
    e_iteams.innerHTML = "";
    let i = 0;
    iteamArr.forEach(e=>{
        i++;
        e_iteams.innerHTML+=e.toHtml();
        if(i%5!=0)e_iteams.innerHTML+="<div class=\"wh\"></div>"
    })
}


arrToHtml();

//禁止空表单提交
function seasubmit(){
    if(e_seatxt.ariaValueMax.trim() == "")return false;
    return true;
}
